<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
	prefix="logic"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
	<head>
		<title>page of team-manage</title>
		<LINK href="css/default.css" rel=stylesheet>
		<style type="text/css">
#id1 {
	width: 100%;
	height: 100%;
	background-color: #000;
	FILTER: alpha(opacity =                                                 50)
		;
	position: absolute;
	top: 0;
	left: 0;
	moz-opacity: 0.8;
	opacity: .80;
	z-index: 49;
}

#id2 {
	top: 10px;
	position: absolute;
	z-index: 90;
	border: 3px solid #E5E5E5;
	left: 200px;
	font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
	background-color: #F5FAFA;
}

#cele_date {
	z-index: 99;
}
</style>
		<script language="javascript" type="text/javascript">
		var date_start,date_end,g_object
var today = new Date();
var separator="-";
var inover=false;

function change_date(temp,mode)
{
	var t_month,t_year
    if (mode){
        if(mode==1)
        t_month=parseInt(cele_date_month.value,10)+parseInt(temp,10);
        else
        t_month=parseInt(temp)
        if (t_month<cele_date_month.options(0).text) {
            cele_date_month.value=cele_date_month.options(cele_date_month.length-1).text;
            change_date(parseInt(cele_date_year.value,10)-1,0);
            }
        else{
            if (t_month>cele_date_month.options(cele_date_month.length-1).text){
                cele_date_month.value=cele_date_month.options(0).text;
                change_date(parseInt(cele_date_year.value,10)+1,0);
                }            
            else
                {cele_date_month.value=t_month;
                 set_cele_date(cele_date_year.value,cele_date_month.value);                
                }
        }
    }  
    else{
        t_year=parseInt(temp,10);
        
        if (t_year<cele_date_year.options(0).text) {
            cele_date_year.value=cele_date_year.options(0).text;
            set_cele_date(cele_date_year.value,1);                
            }
        else{
            if (parseInt(t_year,10)>parseInt(cele_date_year.options(cele_date_year.length-1).text,10)){
                cele_date_year.value=cele_date_year.options(cele_date_year.length-1).text;
                set_cele_date(cele_date_year.value,12);                
                }            
            else
                {cele_date_year.value=t_year;
                 set_cele_date(cele_date_year.value,cele_date_month.value);                
                }
        }
    }

    window.cele_date.focus();

}

//³õÊ¼»¯ÈÕÀú
function init(d_start,d_end)
{
     var temp_str;
     var i=0
     var j=0
     date_start=new Date(1980,7,1)
     date_end=new Date(2004,8,1)
     document.writeln("<div name=\"cele_date\" id=\"cele_date\"  style=\"display:none\"    style=\"LEFT: 69px; POSITION: absolute; TOP: 159px;Z-INDEX:99\" onClick=\"event.cancelBubble=true;\" onBlur=\"hilayer()\" onMouseout=\"lostlayerfocus()\">-</div>");
     window.cele_date.innerHTML="";
     temp_str="<table border=\"1\" bgcolor=\"#DDDDDD\" bordercolor=\"white\"><tr><td colspan=7 onmouseover=\"overcolor(this)\">";
     temp_str+="<input type=\"Button\" value=\"<<\" onclick=\"change_date(-1,1)\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; background-color: #BFBFBF; cursor: hand\">-";

     temp_str+=""
     temp_str+="<select name=\"cele_date_year\" id=\"cele_date_year\" language=\"javascript\" onchange=\"change_date(this.value,0)\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"

     for (i=1949;i<=2049;i++)
     {
     	temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
     }
     temp_str+="</select>-";
     temp_str+=""
     temp_str+="<select name=\"cele_date_month\" id=\"cele_date_month\" language=\"javascript\" onchange=\"change_date(this.value,2)\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"

     for (i=1;i<=12;i++)
     {
     	temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
     }
     temp_str+="</select>-";
     temp_str+=""
     temp_str+="<input type=\"Button\" value=\">>\" onclick=\"change_date(1,1)\" onmouseover=\"getlayerfocus()\"  style=\"color: #000099; background-color: #BFBFBF; cursor: hand\">";

     temp_str+="</td></tr><tr><td onmouseover=\"overcolor(this)\">"
     temp_str+="<font color=red>日</font></td><td>";temp_str+="一</td><td>"; temp_str+="二</td><td>"; temp_str+="三</td><td>"
     temp_str+="四</td><td>";temp_str+="五</td><td>"; temp_str+="六</td></tr>";
     for (i=1 ;i<=6 ;i++)
     {
     temp_str+="<tr>";
        for(j=1;j<=7;j++){
            temp_str+="<td name=\"c"+i+"_"+j+"\"id=\"c"+i+"_"+j+"\" style=\"CURSOR: hand\" style=\"COLOR:#000000\" language=\"javascript\" onmouseover=\"overcolor(this)\" onmouseout=\"outcolor(this)\" onclick=\"td_click(this)\">?</td>"
            }
     temp_str+="</tr>"        
     }
     temp_str+="</td></tr></table>";
     window.cele_date.innerHTML=temp_str;
}
function set_cele_date(year,month)
{
   var i,j,p,k
   var nd=new Date(year,month-1,1);
   event.cancelBubble=true;
   cele_date_year.value=year;
   cele_date_month.value=month;   
   k=nd.getDay()-1
   var temp;
   for (i=1;i<=6;i++)
      for(j=1;j<=7;j++)
      {
      eval("c"+i+"_"+j+".innerHTML=\"\"");
      eval("c"+i+"_"+j+".bgColor=\"#DDDDDD\"");
      eval("c"+i+"_"+j+".style.cursor=\"hand\"");
      }
   while(month-1==nd.getMonth())
    { j=(nd.getDay() +1);
      p=parseInt((nd.getDate()+k) / 7)+1;
      eval("c"+p+"_"+j+".innerHTML="+"\""+nd.getDate()+"\"");
      if ((nd.getDate()==today.getDate())&&(cele_date_month.value==today.getMonth()+1)&&(cele_date_year.value==today.getYear())){
      	 eval("c"+p+"_"+j+".bgColor=\"#EFFB64\"");
      }
      if (nd>date_end || nd<date_start)
      {
      eval("c"+p+"_"+j+".bgColor=\"#FF9999\"");
      eval("c"+p+"_"+j+".style.cursor=\"text\"");
      }
      nd=new Date(nd.valueOf() + 86400000)
    }
}


function show_cele_date(eP,d_start,d_end,t_object)
{
eP=document.getElementById(t_object);
window.cele_date.style.display="";
window.cele_date.style.zIndex=99
var s,cur_d
var eT = eP.offsetTop;  
var eH = eP.offsetHeight+eT;  
var dH = window.cele_date.style.pixelHeight;  
var sT = document.body.scrollTop; 
var sL = document.body.scrollLeft; 
event.cancelBubble=true;
window.cele_date.style.posLeft = event.clientX-event.offsetX+sL-5;  
window.cele_date.style.posTop = event.clientY-event.offsetY+eH+sT-5;
if (window.cele_date.style.posLeft+window.cele_date.clientWidth>document.body.clientWidth) window.cele_date.style.posLeft+=eP.offsetWidth-window.cele_date.clientWidth;
if (d_start!=""){
    if (d_start=="today"){
        date_start=new Date(today.getYear(),today.getMonth(),today.getDate());
    }else{
        s=d_start.split(separator);
        date_start=new Date(s[0],s[1]-1,s[2]);
    }
}else{
    date_start=new Date(1949,1,1);
}

if (d_end!=""){
    s=d_end.split(separator);
    date_end=new Date(s[0],s[1]-1,s[2]);
}else{
    date_end=new Date(3000,1,1);
}

//g_object=t_object
g_object=document.getElementById(t_object);

cur_d=new Date()
set_cele_date(cur_d.getYear(),cur_d.getMonth()+1);
window.cele_date.style.display="block";

window.cele_date.focus();

}
function td_click(t_object)
{
var t_d
if (parseInt(t_object.innerHTML,10)>=1 && parseInt(t_object.innerHTML,10)<=31 ) 
{ t_d=new Date(cele_date_year.value,cele_date_month.value-1,t_object.innerHTML)
if (t_d<=date_end && t_d>=date_start)
{
var year = cele_date_year.value;
var month = cele_date_month.value;
var day = t_object.innerHTML;
if (parseInt(month)<10) month = "0" + month;
if (parseInt(day)<10) day = "0" + day;

g_object.value=year+separator+month+separator+day;
window.cele_date.style.display="none";};
}

}
function h_cele_date()
{
window.cele_date.style.display="none";
}

function overcolor(obj)
{
  if (obj.style.cursor=="hand") obj.style.color = "#FFFFFF";

  inover=true;
  window.cele_date.focus();

}

function outcolor(obj)
{
	obj.style.color = "#000000";
	inover=false;

}

function getNow(o){
    var Stamp=new Date();
    var year = Stamp.getYear();
    var month = Stamp.getMonth()+1;
    var day = Stamp.getDate();
    if(month<10){
	month="0"+month;
    }
    if(day<10){
	day="0"+day;
    }
    o.value=year+separator+month+separator+day;
}

function hilayer()
{
	if (inover==false)
	{
		var lay=document.all.cele_date;
		lay.style.display="none";
	}
}
function getlayerfocus()
{
	inover=true;
}
function lostlayerfocus()
{
	inover=false;
}
init();
		function show(){
		id1.style.height=document.body.scrollHeight+"px";
		id1.style.width=document.body.scrollWidth+"px";
		id1.style.display="";
		id2.style.display="";
		}
		function hide(){
		id1.style.display="none";
		id2.style.display="none";
		}
		function opchange(o){
		document.campcontrsltForm.method.value=o;
		document.campcontrsltForm.submit();
		}
		
		
		</script>
		
	</head>
	<body>
		<table width="880" cellspacing="0" cellpadding="0" border="0">
			<tbody>
				<tr>
					<td width="3" height="31">
						<img height="31" src="./images/table_01.gif" width="3" />
					</td>
					<td background="./images/table_02.gif" height="31">
						<table cellspacing="0" cellpadding="0" width="146" align="left"
							border="0">
							<tbody>
								<tr>
									<td width="51" background="./images/title_1_bg.gif">
										<img height="31" src="./images/title_1.gif" width="51" />
									</td>
									<td width="95" background="./images/title_1_bg.gif">
										<span class="color_b_666">接触结果管理</span>
									</td>
								</tr>
							</tbody>
						</table>
					</td>
					<td width="3">
						<img height="31" src="./images/table_03.gif" width="3" />
					</td>
				</tr>
				<tr>
					<td width="3" background="./images/table_04.gif" width="3"
						align="right">
						<img height="100%" src="./images/table_04.gif" width="3" />
					</td>
					<td>
						<logic:present name="campcontrsltlist">
							
							<table width="770" border="0" align="center" cellpadding="5"
								cellspacing="1" bgcolor="#FF9900">
								<tr>
									<th>
										<bean:message key="campcontrslt.jsp.contSeqId" />
									</th>
									<th>
										<bean:message key="campcontrslt.jsp.contTime" />
									</th>
									<th>
										<bean:message key="campcontrslt.jsp.userId" />
									</th>
									<th>
										<bean:message key="campcontrslt.jsp.campContRsltLvlId" />
									</th>
									<th>
										<bean:message key="campcontrslt.jsp.appointTime" />
									</th>
									<th>
										<bean:message key="common.jsp.operation" />
										<a href="campcontrslt.do?method=list&campid=${campid}&campseqid=${campseqid}&indexid=${indexid}"> <u> 
											<bean:message key="common.jsp.addlink" /> </u> </a>
									</th>
								</tr>
								<logic:iterate name="campcontrsltlist" id="i">
									<tr bgcolor="ffffff">
										<td>
											<bean:write name="i" property="contSeqId" />
										</td>
										<td class="alt">
											<bean:write name="i" property="contTime" />
										</td>
										<td>
											<bean:write name="i" property="userId" />
										</td>
										<td class="alt" >
											<span style="cursor:hand;" title="<bean:write name="i" property="remark" />">
											<bean:write name="i" property="campContRsltLvlName" /></span>
										</td>
										<td>
											<bean:write name="i" property="appointTime" />
										</td>
										<td class="alt">
											<html:link
												href="campcontrslt.do?method=list&campid=${i.campId}&campseqid=${i.campSeqId}&indexid=${indexid}&contseqid=${i.contSeqId}">
												<u><bean:message key="common.jsp.viewlink" /> </u>
											</html:link>
										</td>
									</tr>
								</logic:iterate>
							</table>
						</logic:present>
						<html:form action="/campcontrslt">
							<logic:present name="campcontrslt" scope="request">
								

									<table width="500" border="0" align="center" cellpadding="5"
										cellspacing="1" bgcolor="#FF9900">
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.contSeqId" />
											</td>
											<td>
												<html:text readonly="true" property="campcontrslt.contSeqId"
													value="${campcontrslt.contSeqId}" />
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.contTime" />
											</td>
											<td>
												<html:text readonly="true" property="campcontrslt.contTime"
													value="${campcontrslt.contTime}" />
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.userId" />
											</td>
											<td>
												<html:text property="campcontrslt.userId"
													value="${campcontrslt.userId}" />
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.campContRsltLvlId" />
											</td>
											<td>
												<html:text readonly="true"
													property="campcontrslt.campContRsltLvlId"
													value="${campcontrslt.campContRsltLvlName}" />
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.appointTime" />
											</td>
											<td>
												<html:text property="campcontrslt.appointTime"
													value="${campcontrslt.appointTime}" />
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.remark" />
											</td>
											<td>
												<html:textarea cols="40" rows="6"
													property="campcontrslt.remark"
													value="${campcontrslt.remark}"></html:textarea>
											</td>
										</tr>

										<tr>
											<td colspan="2" align="center" valign="middle">
												<img src='images/button_cancel.gif' width="63" height="21" onclick="opchange('list')" />
											</td>
										</tr>
									</table>

								
							</logic:present>
							<logic:notPresent name="campcontrslt" scope="request">
								
									<table width="500" border="0" align="center" cellpadding="5"
										cellspacing="1" bgcolor="#FF9900">

										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.campContRsltLvlId" />
											</td>
											<td>
												<html:select property="campcontrslt.campContRsltLvlId">
													<logic:iterate name="CampContRsltLvlList" id="j">
														<html:option value="${j.codeId}">
															<bean:write name="j" property="codeName" />
														</html:option>
													</logic:iterate>
												</html:select>
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.appointTime" />
											</td>
											<td>
												<html:text property="campcontrslt.appointTime"
													value="${campcontrslt.appointTime}"
													onfocus="show_cele_date('campcontrslt.appointTime','','','campcontrslt.appointTime')" />
												<select name="appointhour">
													<%
														out.print("<option value='08'>8</option>");
														out.print("<option value='09'>9</option>");
														for (int i = 10; i < 23; i++)
															out.print("<option value='" + i + "'>" + i + "</option>");
													%>
												</select>
												时
												<select name="appointmin">
													<%
														out.print("<option value='00'>0</option>");
														for (int i = 1; i < 4; i++)
															out.print("<option value='" + i * 15 + "'>" + i * 15
															+ "</option>");
													%>
												</select>
												分
											</td>
										</tr>
										<tr>
											<td>
												<bean:message key="campcontrslt.jsp.remark" />
											</td>
											<td>
												<html:textarea property="campcontrslt.remark" cols="40"
													value="" rows="6"></html:textarea>
											</td>
										</tr>
										<tr>
											<td align="center" valign="middle" colspan="2">
												<img src='images/button_true.gif' width="63" height="21" onclick="opchange('save')" />
												&nbsp;&nbsp;
												<img src='images/button_cancel.gif' width="63" height="21" onclick="" />
											</td>
										</tr>
									</table>
									<script language="javascript" type="text/javascript"></script>
								


							</logic:notPresent>
							<html:hidden property="campid" value="${campid}" />
							<html:hidden property="campseqid" value="${campseqid}" />
							<html:hidden property="indexid" value="${indexid}" />

							<html:hidden property="campcontrslt.campId" value="${campid}" />
							<html:hidden property="campcontrslt.campSeqId"
								value="${campseqid}" />
							<html:hidden property="method" value="save" />
						</html:form>
					</td>
					<td background="./images/table_05.gif" width="3" align="left">
						<img height="100%" src="./images/table_05.gif" width="3">
					</td>
				</tr>
				<tr>
					<td height=3 valign="top">
						<img height="12px" src="./images/table_06.gif" width="3px">
					</td>
					<td height=3 valign="top">
						<img height="3px" src="./images/table_07.gif" width="100%">
					</td>
					<td height=3 valign="top">
						<img height="12px" src="./images/table_08.gif" width="3px">
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>